package com.base.day6;

import java.util.ArrayList;
import java.util.Date;

public class OrderController {
	ArrayList orderlist=new ArrayList();
	//预约
	public boolean book(Car target, Date d, String type){
		boolean rs=false;
		Shop shop=new Shop();
		shop.setAddress("上海市浦东新区临港大道101号");
		shop.setMobile("155487533");
		shop.setName("汽车之家");
		if(orderlist.size()<10){
			Order order=new Order( target, shop,  d,  type);
			orderlist.add(order);
			rs=true;
		}else{
			System.out.println("预约已满");
		}
		return rs;
	}
	
	//完成订单
	public boolean finishOder(Order order){
		return orderlist.remove(order);
	}
	
	
	//查看门店所有订单
	public ArrayList showAll(){
			return orderlist;
		}
	
	//打印所有订单
		public void print(){
				for(int i=0;i<orderlist.size();i++){
					Order o=(Order) orderlist.get(i);
					System.out.println(o.getCar().getCustomer().getName());
					System.out.println("下单时间："+o.getCreateDate());
					System.out.println("预约车辆:"+o.getCar().getColor()+o.getCar().getName()+o.getCar().getNo());
					System.out.println("预约时间："+o.getBookDate());
					System.out.println("服务类型："+o.getType());
				}
			}


}
